<template>
	<view>
				<cu-custom bgColor="bg-gradual-red" :isBack="true">
					<block slot="backText">返回</block>
					<block slot="content">个人信息</block>
				</cu-custom>
				
				  <view class="cu-form-group margin-top">	
								<view class="title">用户名</view>
								<input  v-model="userinfo.username" name="input"></input>
							</view>
							<view class="cu-form-group">
								<view class="title">姓名</view>
								<input v-model="userinfo.realname" name="input"></input>
							</view>
							<view class="cu-form-group">
								<view class="title">邮箱</view>
								<input placeholder="统一标题的宽度" name="input"></input>
							</view>
							<view class="cu-form-group">
								<view class="title">性别</view>
								<input placeholder="输入框带个图标" name="input"></input>
								<text class='cuIcon-locationfill text-orange'></text>
							</view>
							<view class="cu-form-group">
								<view class="title">验证码</view>
								<input placeholder="输入框带个按钮" name="input"></input>
								<button class='cu-btn bg-green shadow'>验证码</button>
							</view>
							<view class="cu-form-group">
								<view class="title">手机号码</view>
								<input  v-model="userinfo.mobilePhone" name="input"></input>
								<view class="cu-capsule radius">
									<view class='cu-tag bg-blue '>
										+86
									</view>
									<view class="cu-tag line-blue">
										中国大陆
									</view>
								</view>
							</view>
				
				
				
				
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo:{}
			}
		},
		onLoad:function(){
			//判断一下是否登陆
			this.init()
		},
		methods: {
			init:function(){
				//发送网络请求 获取用户信息
				//获取id信息 从本地存储中获取id
				
				
				let token;
				try {
					let value = uni.getStorageSync('login_token_key');
					if(value){
						token="Bearer "+value;
					}
				} catch (e) {
					// error
				}
				
				try {
					const id_value = uni.getStorageSync('login_user_id');
					if (id_value) {
						
						uni.request({
						    url: 'http://123.57.7.108:2048/emall/customer/'+id_value, 
						    header: {
						        'Authorization': token //自定义请求头信息
						    },
						    success: (res) => {
								var data=res.data;
						       if(data.code==200){
								   console.log(JSON.stringify(data.data))
								  this.userinfo  = data.data;
							   }
						    }
						});
						
						
						//
						
						
						
					}else{
						uni.showToast({
							title:'没有登陆信息',
							duration:2000
							
						})
					}
				} catch (e) {
					// error
				}
				
				
				
				
				
			}
		}
	}
</script>

<style>

</style>
